package com.tjtt.tdm.system.service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.tjtt.tdm.base.PageResult;
import com.tjtt.tdm.exception.DaoException;
import com.tjtt.tdm.exception.ServiceException;
import com.tjtt.tdm.system.bean.Organization;
import com.tjtt.tdm.system.bean.Users;

public interface UserService {
	/**
	 * 根据条件查询用户信息
	 * @param paramMap
	 * @param totalCount
	 * @param start
	 * @param limit
	 * @param sort
	 * @param dir
	 * @return
	 * @throws ServiceException
	 */
	public List<Users> findUsers(HashMap<String, Object> paramMap,long totalCount, long start,
			long limit, String sort, String dir) throws ServiceException;
	/**
	 * 根据条件分页获取对象集合
	 * @param start
	 * @param limit
	 * @param sort
	 * @param dir
	 * @param wheresql
	 * @return
	 * @throws DaoException
	 */
	public List<Users> getListByHql(Integer start, Integer limit, String sort,
			String dir, String wheresql)throws DaoException;
	
	/**
	 * 根据条件获取对象总数
	 * @param wheresql
	 * @return
	 * @throws DaoException
	 */
	public long getTotalCountByWhereHql(String wheresql) throws DaoException;
	/**
	 * 查询角色是否有子节点
	 * @param paramMap
	 * @return
	 * @throws ServiceException
	 *  2011-9-22
	 */
	public Long getCroleByRoleId(HashMap<String, Object> paramMap) throws ServiceException;
	/**
	 * 根据条件查询用户总数
	 * @param paramMap
	 * @return
	 * @throws ServiceException
	 */
	public Long getTotalCount(HashMap<String, Object> paramMap) throws ServiceException;
	/**
	 * 查询角色是否与用户有关联
	 * @param paramMap
	 * @return
	 * @throws ServiceException
	 * cm 2011-9-22
	 */
	public Long getTotalCountByRoleId(HashMap<String, Object> paramMap) throws ServiceException;
	/**
	 * 根据userId获取用户信息
	 * @param userId
	 * @return
	 * @throws ServiceException
	 */
	public Users getUsers(Long userId) throws ServiceException;
	/**
	 * 修改用户信息
	 * @param userId
	 * @throws ServiceException
	 */ 
	public void updateUsers(Users user ,String roleIdStr) throws ServiceException;
	/**
	 * 修改用户信息
	 * @param userId
	 * @throws ServiceException
	 */
	public void updateUserInfo(Users user) throws ServiceException;	
	/**
	 * 修改用户信息
	 * @param userId
	 * @throws ServiceException
	 */
	public void editUserInfo(Users user) throws ServiceException;	
	
	/**
	 * 保存用户信息
	 * 新加用户保存的同时保存用户的角色
	 * @param user
	 * @param roleIds
	 * @throws ServiceException
	 * cm 2011-9-19
	 */
	public void saveUsers(Users user,String roleIds) throws ServiceException;
	
	/**
	 * 修改用户密码的修改时间
	 * @param userId 用户id
	 * @throws ServiceException void
	 * @author 曹晓芳
	 * @date Aug 31, 2012 10:23:44 AM
	 */
	public void updatePswEditTime(Long userId) throws ServiceException;
	
	/**
	 * 用户检查
	 * @param loginName
	 * @param psw
	 * @return
	 * @throws ServiceException
	 */
	public Users checkUser(String loginName,String psw) throws ServiceException;
	
	/**根据组织机构的Id查询用户*/
	public List<Users> findUsersByOrgId(int start,int limit,Long orgId)throws ServiceException;
	
	/**
	 * 根据角色的ID查询用户
	 * @param roleId 角色的Id
	 * @return 该角色下的用户
	 * @throws ServiceException
	 * @author anlu
	 */
	public List<Users> findUsersByRoleId(Long roleId)throws ServiceException;
	/**分页查询角色用户*/
	public List<Users> searchUsersByRoleId(Long roleId,long start,
			long limit)throws ServiceException;
	/**
	 * 根据角色的ID查询用户
	 * @param roleId 角色的Id
	 * @return 该角色下的用户
	 * @throws ServiceException
	 * @author anlu
	 */
	public List<Users> findAllUsersByRoleId(HashMap<String, Object> paramMap,long totalCount, long start,
			long limit, String sort, String dir)throws ServiceException;
	/**
	 * 查询所有的一级菜单
	 * @param role
	 * @return
	 * @throws ServiceException List<Menu>
	 * @author 李数
	 * @date 2012-8-27 上午11:32:29
	 */
	public List findFirstMenu(String role) throws ServiceException;
	/**
	 * 获取常用功能菜单
	 * @param userId
	 * @return
	 * @throws ServiceException List
	 * @author 李数
	 * @date 2012-9-3 下午08:18:40
	 */
	public List findOftenMenu(String userId) throws  ServiceException;
    /**
     * 通过id查询用户信息
     * @param Users
     * @return Users
     * @author 宿馨月
     * @date 2012-9-06 下午14:12:15
     */
    public Users findUsersById(long userid);
    
    /**
     * 通过loginname查询用户信息
     * @param loginname
     * @return
     */
    public Users findUsersByName(String loginname);
    
	public String findUserDelflagByOrgId(String ids);
	
	public PageResult queryUserList(Map filterMap) throws ServiceException;
	
	public PageResult queryUser(Map filterMap);
	public Users findUsersByloginName(String loginname);
	public Organization findOrganationByorgId(Long orgId);
	public PageResult queryUserList2(Map<String, String> filterMap);
	public Users findUsersByUserName(String username);
	public PageResult queryChooseData(Map<String, String> filterMap) ;
	public List getDatabySql(String sql);	
	
}
